#include "exti.h"
#include "key.h"
void EXTIX_Init(void)
{
		EXTI_InitTypeDef EXTI_InitStructure;
		NVIC_InitTypeDef NVIC_InitStructure;
		KEY_Init();
		NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);
		RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO,ENABLE);	
	//中断线初始化 PE0
  	GPIO_EXTILineConfig(GPIO_PortSourceGPIOE,GPIO_PinSource0);
  	EXTI_InitStructure.EXTI_Line=EXTI_Line0;	
  	EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;	
  	EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling;
  	EXTI_InitStructure.EXTI_LineCmd = ENABLE;
  	EXTI_Init(&EXTI_InitStructure);	 
    //中断线初始化 PE1
  	GPIO_EXTILineConfig(GPIO_PortSourceGPIOE,GPIO_PinSource1);
  	EXTI_InitStructure.EXTI_Line=EXTI_Line1;
		EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;	
  	EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling;
  	EXTI_InitStructure.EXTI_LineCmd = ENABLE;
  	EXTI_Init(&EXTI_InitStructure);	  
	//中断线初始化 PE2
  	GPIO_EXTILineConfig(GPIO_PortSourceGPIOE,GPIO_PinSource2);
  	EXTI_InitStructure.EXTI_Line=EXTI_Line2;
		EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;	
  	EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling;
  	EXTI_InitStructure.EXTI_LineCmd = ENABLE;
  	EXTI_Init(&EXTI_InitStructure);	  
	//中断线初始化 PE3
		GPIO_EXTILineConfig(GPIO_PortSourceGPIOE,GPIO_PinSource3); 
  	EXTI_InitStructure.EXTI_Line=EXTI_Line3;
		EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;	
  	EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling;
  	EXTI_InitStructure.EXTI_LineCmd = ENABLE;
  	EXTI_Init(&EXTI_InitStructure);
	//中断线初始化 PE4
		GPIO_EXTILineConfig(GPIO_PortSourceGPIOE,GPIO_PinSource4); 
  	EXTI_InitStructure.EXTI_Line=EXTI_Line4;
		EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;	
  	EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling;
  	EXTI_InitStructure.EXTI_LineCmd = ENABLE;
  	EXTI_Init(&EXTI_InitStructure);
	//中断线初始化 PE5
		GPIO_EXTILineConfig(GPIO_PortSourceGPIOE,GPIO_PinSource5); 
  	EXTI_InitStructure.EXTI_Line=EXTI_Line5;
		EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;	
  	EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling;
  	EXTI_InitStructure.EXTI_LineCmd = ENABLE;
  	EXTI_Init(&EXTI_InitStructure);
	//中断线初始化 PE6
		GPIO_EXTILineConfig(GPIO_PortSourceGPIOE,GPIO_PinSource6); 
  	EXTI_InitStructure.EXTI_Line=EXTI_Line6;
		EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;	
  	EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling;
  	EXTI_InitStructure.EXTI_LineCmd = ENABLE;
  	EXTI_Init(&EXTI_InitStructure);
	//中断线初始化 PE7
		GPIO_EXTILineConfig(GPIO_PortSourceGPIOE,GPIO_PinSource7); 
  	EXTI_InitStructure.EXTI_Line=EXTI_Line7;
		EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;	
  	EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling;
  	EXTI_InitStructure.EXTI_LineCmd = ENABLE;
  	EXTI_Init(&EXTI_InitStructure);
	//中断优先级设置
  	NVIC_InitStructure.NVIC_IRQChannel = EXTI0_IRQn;		
  	NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x00;	
  	NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x00;		
  	NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;						
  	NVIC_Init(&NVIC_InitStructure); 
    NVIC_InitStructure.NVIC_IRQChannel = EXTI1_IRQn;			
  	NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x00;	 
  	NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x00;				
  	NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;						
  	NVIC_Init(&NVIC_InitStructure);
  	NVIC_InitStructure.NVIC_IRQChannel = EXTI2_IRQn;			
  	NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x00;	
  	NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x00;			
  	NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;						
  	NVIC_Init(&NVIC_InitStructure);  	  
		NVIC_InitStructure.NVIC_IRQChannel = EXTI3_IRQn;		
  	NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x00;	
  	NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x00;				
  	NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;						
  	NVIC_Init(&NVIC_InitStructure);  	
		NVIC_InitStructure.NVIC_IRQChannel = EXTI4_IRQn;		
  	NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x00;	
  	NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x00;				
  	NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;						
  	NVIC_Init(&NVIC_InitStructure); 
		NVIC_InitStructure.NVIC_IRQChannel = EXTI9_5_IRQn;		
  	NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x00;	
  	NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x00;				
  	NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;						
  	NVIC_Init(&NVIC_InitStructure); 
}